<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ include file="/WEB-INF/jsp/commons/taglibs.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>E-天下商旅</title>

<link href="${ctx}/resources/css/page_operat.css" rel="stylesheet" type="text/css">
</head>

<body>
  <body>

<jsp:include page="../commons/header.jsp" >
	 <jsp:param name="currentMenu" value="menu5"/>
</jsp:include>



<div class="main_box">
<div class="main cf">

	<jsp:include page="../commons/left.jsp"></jsp:include>
	<div class="right">
		<div class="right_box" id="right_box">
			<div class="title"><span><a href="#">报名游线</a></span></div>
			<div class="content cf">
				<div class="signup_box">
					<form id="signup" action="${ctx}/travelApply/apply" >
					     <input type="hidden" name="tId" value="${lineInfo.id }" />
						<div>
							<label>活动名称</label>${lineInfo.lineName }
						</div>			
						<div>
							<label>出发地点</label>${lineInfo.departureCity }
						</div>			
						<div>
							<label>承办旅行社</label>${lineInfo.releaseUnit }
						</div>		
						<div>
							<label>市场价</label>${lineInfo.price }
						</div>		
						<div>
							<label>VIP会员价</label>${lineInfo.vipPrice }
						</div>			
						<div>
							<label><i>* </i>申请参团日期</label>
							<input class="Wdate" type="text" name="applyTime" readonly="readonly" onClick="WdatePicker()"/><span></span>
						</div>			
						<div>
							<label>是否有儿童</label>
                            <input name="child" type="checkbox" value="1"> <b style="color:#f00; font-weight:100;">(儿童价标准：身高0.8~1.2米，不含床，只含当地用车及餐费，其他费用产生处理。)</b>
						</div>	
						<div>
							<label><i>* </i>姓名</label>
							<input type="text" class="input" name="name"  /><span></span>
						</div>
						<div>
							<label><i>* </i>性别</label>
							<input id="man" type="radio" value="0" name="sex" checked="checked">男 <input id="woman" type="radio" value="1" name="sex">女 
						</div>
						<div>
							<label><i>* </i>身份证号码</label>
							<input type="text" class="input" name="cardno"  /><span></span>
						</div>
						<div>
							<label><i>  </i>港澳通行证号码</label>
							<input type="text" class="input" name="hkmaCardno"  /><span></span>
						</div>
						<div>
							<label><i>  </i>护照号码</label>
							<input type="text" class="input" name="passport"  /><span></span>
						</div>
						<div>
							<label><i>* </i>地址</label>
							<input type="text" class="input" name="address"  /><span></span>
						</div>
						<div>
							<label><i>* </i>联系手机</label>
							<input type="text" class="input" name="phone"  /><span></span>
						</div>
						<div>
							<label><i>* </i>邮箱</label>
							<input type="text" class="input" name="email"  /><span></span>
						</div>
						<div>
							<label>备注</label>
							<input type="text" class="input" name="remark" style="width:400px;"  />
						</div>
                        <div>
 							<label>&nbsp;</label>
							<input type="submit" class="submit btn_orange" value="立即报名" />
                        </div>
					</form>
				</div>
			</div>

		</div>
	</div>
		
</div>
</div>

<jsp:include page="../commons/footer.jsp"></jsp:include>

<script src="${ctx}/resources/script/validate/jquery-1.4.min.js" type="text/javascript"></script>
<script src="${ctx}/resources/script/My97DatePicker/WdatePicker.js"></script>
<script src="${ctx}/resources/script/common.js"></script>
<script type="text/javascript" src="${ctx}/resources/script/validate/jquery.validate.js"></script>
<script type="text/javascript" src="${ctx}/resources/script/validate/jquery.metadata.js"></script>
<script type="text/javascript" src="${ctx}/resources/script/validate/additional-methods.js" charset="utf-8"></script>
<script type="text/javascript" src="${ctx}/resources/script/validate/messages_cn.js" charset="utf-8"></script>
<script type="text/javascript">


function ajaxApply(){
	var url = "${ctx}/travelApply/apply?timestap="+(new Date()).valueOf();	
    $.ajax({
        type: "post",
        async:false,
        url: url,
        dataType: "json",
        data:$("form").serialize(),
        success: function(getmsg){  
            if(getmsg.code==1) {
        		alert("申请成功");
        		window.location.href="${ctx}/travelApply/index?tId=${lineInfo.id }";
            } 

        }
    });
}

$(function() {	
	$.validator.setDefaults({
		submitHandler: function() { ajaxApply(); }
	});

	$("form").validate({	
		rules : {
			applyTime:{
				required : true
			},
 			name:{
 				required : true
 			},
 			cardno:{
 				required : true,
 				isIdCardNo: true
 			},
 			address:{
 				required : true
 			},
 			phone:{
 				required : true,
 				mobile:true
 			},
 			email:{
 				required : true,
 				email: true
 			}		
		},
		errorPlacement : function(error, element) {
			error.appendTo(element.next("span"));
		},
		messages : {
			applyTime:{
				required:"请选择参团时间"
 			},
 			name:{
 				required:"名字不能为空"
 			},
 			cardno:{
 				required:"身份证必填",
 				isIdCardNo:"请填写正确的身份证号码"
 			},
 			address:{
 				required : "地址不能为空"
 			},
 			phone:{
 				required : "电话不能为空",
 				mobile:"请填写正确的手机号码"
 			},
 			email:{
 				required : "email地址不能为空",
 				email: "请填写正确的email地址"
 			}
			
		}
	 });
});	  
</script>
</body>
</html>

